﻿using System.Data;
using Navigant.Infrastructure.Cases;
using Navigant.Infrastructure.EntityFactoryFramework;
using Navigant.Infrastructure.Helpers;
using Navigant.Model.PreservationNotices;

namespace Navigant.Infrastructure.Repositories
{
    public class PreservationNoticeTemplateFactory : IEntityFactory<PreservationNoticeTemplate>
    {
        #region Field Names

        internal static class FieldNames
        {
            public const string Id = "ID";
            public const string Name = "Title";
            public const string MessageSubject = "Message_x0020_Subject";
            public const string MessageBody = "Message_x0020_Body";
            // Commented Code to remove status field from Preservation Notice
            //public const string Status = "Status";
        }

        #endregion

        #region IEntityFactory<PreservationNoticeTemplate> Members

        public PreservationNoticeTemplate BuildEntity(IDataReader reader, ICase parentCase)
        {
            return new PreservationNoticeTemplate(DataHelper.GetInteger(reader[FieldNames.Id]),
                parentCase,
                DataHelper.GetString(reader[FieldNames.Name]),
                DataHelper.GetString(reader[FieldNames.MessageSubject]),
                DataHelper.GetString(reader[FieldNames.MessageBody]));
            // Commented Code to remove status field from Preservation Notice
            //DataHelper.GetEnumValue<PreservationNoticeTemplateStatus>(reader[FieldNames.Status]));
        }

        public void LoadExtendedProperties(IDataReader reader, PreservationNoticeTemplate entity)
        {
        }

        #endregion
    }
}
